package models

// Member 管理员表
type Member struct {
	ID uint `gorm:"primary_key" json:"id"`
	BaseModel
	Username string `gorm:"unique;column:username;type:varchar(100)" json:"username"` // 用户名（账号）
	Mobile   string `gorm:"unique;column:mobile;type:varchar(30)" json:"mobile"`      // 手机号
	Email    string `gorm:"unique;column:email;type:varchar(100)" json:"email"`       // 邮箱
	Password string `gorm:"column:password;type:varchar(255)" json:"-"`               // 密码
	RealName string `gorm:"column:real_name;type:varchar(255)" json:"realName"`       // 真实姓名
	Sex      int8   `gorm:"column:sex;type:tinyint" json:"sex"`                       // 性别
	Status   int8   `gorm:"column:status;type:tinyint" json:"status"`                 // 状态
	Role     []Role `gorm:"many2many:member_role;" json:"role"`
}

// TableName get sql table name.获取数据库表名
func (m *Member) TableName() string {
	return "member"
}

// MemberColumns get sql column name.获取数据库列名
var MemberColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	DeletedAt string
	Username  string
	Mobile    string
	Email     string
	Password  string
	RealName  string
	Sex       string
	Status    string
}{
	ID:        "id",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	DeletedAt: "deleted_at",
	Username:  "username",
	Mobile:    "mobile",
	Email:     "email",
	Password:  "password",
	RealName:  "real_name",
	Sex:       "sex",
	Status:    "status",
}
